const API_BASE_URL = 'http://39.98.85.248:3002';
const request = (url, data) => { 
  let _url = API_BASE_URL  + url;
  return new Promise((resolve, reject) => {
    wx.request({
      url: _url,
      method: "get",
      data: data,
      header: {
        'Content-Type': 'application/x-www-form-urlencoded'
      },
      success(request) {
        resolve(request.data)
      },
      fail(error) {
        reject(error)
      }
    })
  });
}

module.exports ={

//   0: pc 1: android 2: iphone 3: ipad
  getBanner: data=>{
    return request('/banner?type=',data)
  },

  getSong: function(data){
    return request('/playlist/detail?id='+data.id)
  },

  getSongsUrl: id=>{
    return request('/song/url?id='+id.id)
  },

}